<template>
	<view style="background-color: #FFFFFF;padding-bottom: 40rpx;">
		<text class="tline"></text>
		<view class="pl25 pr25 pt25">
			<textarea class="mt25 brund15 w100 block pad20 box" placeholder="请填写撤销结算原因" v-model="reason"></textarea>
		    <!-- <view class="mt30 c666">快速填写</view> -->
		</view>
		<view style="width: 100%;position: fixed;bottom: 40rpx;display: flex;align-items: center;justify-content: space-around;">
			<view class="add-btn"  @click="submit">提交</view>
		</view>
		<uni-popup ref="popup" type="message">
		    <uni-popup-message :type="warnType" :message=warnMessage :duration="warnTime"></uni-popup-message>
		</uni-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				warnMessage:'错误',//消息内容
				warnType:'warn',//消息类型  success/warn/info/error
				warnTime:1000,//消息提醒延长时间
				reason:'',//撤销原因
				medicalNum:'',//就诊流水号
				initReason:['医生未回复','病情已好转','换医生咨询','医生专业度不够'],
				usrUserId:null,
			};
		},
		onLoad(option) {
			this.medicalNum = option.medicalNum;
			this.usrUserId=uni.getStorageSync("usrUserId")
		},
		methods: {
			submit(){
				var that = this;
				var medicalNumParm = that.medicalNum;//用户id
				var reasonParm = that.reason;//反馈内容
				uni.showModal({
				    title: '提示',
				    content: '是否确定撤销结算',
				    success: function (res) {
				        if (res.confirm) {
							that.isSbt = true;
							that.func.$request('regulator/regulatorRefundReport.tz',{medicalNum : medicalNumParm, reason : reasonParm},'GET').then(item=>{
								that.isSbt = false;
								if(item.data.code = '00000'){
									that.warnMessage = '提交成功';
									that.warnType = 'success';
									that.$refs.popup.open();
								}
							}).catch(error=>{
								that.isSbt = false;
								that.warnMessage = item.data.errMsg;
								that.warnType = 'error';
								that.warnTime  = 3000;
								that.$refs.popup.open();
							}).finally(() => {
								setTimeout(()=>{
									that.isSbt = false;
									uni.navigateBack({
										delta:1
									})
									//首页我的跳转
									// uni.reLaunch({
									// 	url: '/pages5/advisory/index?tab=2&userId='+that.usrUserId
									// });
								},2000)
							})
			
				        } else if (res.cancel) {
							that.isSbt = false;
				            
				        }
				    }
				});
			}
		}
	};
</script>

<style lang="less">
	.add-btn{
		margin: auto;
		height: 88rpx;
		line-height: 88rpx;
		width: 90%;
		background: #BE965B;
		border-radius: 44rpx;
		color: #FFFFFF;
		text-align: center;
	}
	textarea{
		height: 300rpx;
		border: 1rpx solid #efefef;
	}
	.result{
		text{
			display: inline-block;
			line-height: 50rpx;
			padding: 0 20rpx;
			border-radius: 25rpx;
			background: #efefef;
			margin:15rpx 20rpx;
		}
	}
	.bottomBtn{
		position: fixed;
		width: 100%;
		height: 100rpx;
		left: 0;
		bottom: 25rpx;
		
		.btns{
			width: 660rpx;
			height: 100rpx;
			line-height: 100rpx;
			border-radius: 10rpx;
			background: #BE965B;
		}
	}
</style>
